package org.domain.sigepac.session;

import org.domain.sigepac.Utils;
import org.domain.sigepac.Entity.Declaracao;
import org.domain.sigepac.home.EntityHomeSupport;
import org.domain.sigepac.repository.RepositorioDeclaracao;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Begin;
import org.jboss.seam.annotations.FlushModeType;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.international.StatusMessages;

@Name("declaracaoHome")
@Scope(ScopeType.CONVERSATION)
public class DeclaracaoHome extends EntityHomeSupport<Declaracao> {

	private static final long serialVersionUID = 5235465966047756351L;

	@In
	private StatusMessages statusMessages;

	@In
	private RepositorioDeclaracao repositorioDeclaracao;

	public DeclaracaoHome() {
		// TODO Auto-generated constructor stub
	}


	@Override
	protected Declaracao createInstance() {
		return new Declaracao();
	}



	public void salvar(){

	//	persist();
		repositorioDeclaracao.inserir(getInstance());
		Utils.entityManagerFlush();
		createdMessage();

	}

	@Begin(flushMode=FlushModeType.MANUAL,join=true)
	public void setIdDeclaracao(Integer id) {
	    setId(id);

	 }

	public Integer getIdDeclaracao() {
	    return (Integer) getId();
	  }

}
